vcPointSet

Used for creating and rendering point clouds and/or data points.

See in: Overview

Module: vcGeometry

Parent: vcGeometrySet

Children -

Referenced by: -

Properties

Learn how to use properties here. The properties are also inherited from the parent class.

NameTypeAccessDescription
ColorConfigurationvcPointSetColorConfigurationRWGets or sets the color format for points. By default, the color format is RGBA.
IncrementalBoundUpdateBooleanRWGets or sets if the bounding box should be updated on every added point or not.
PointCountIntegerRGets the number of points in the point set.
PointSizeRealRWGets or sets the size (in pixels) of points in set.
ScaleRealRWGets or sets a factor for scaling the point coordinates. In other words, this scales the volume of the point set.

Methods

Learn how to use methods here. The methods are also inherited from the parent class.

NameReturn TypeParametersDescription
addPointIntegerReal x,
Real y,
Real z
Adds a point to the set. The point coordinates are in World coordinate system. The point is assigned default color.
See more
Parameters:
x (float): X coordinate of the point.
y (float): Y coordinate of the point.
z (float): Z coordinate of the point.

Returns:
int: The index of the new point in the set.
addPointIntegervcVector pointAdds a point to the set. The point coordinates are in World coordinate system. The point is assigned default color.
See more
Parameters:
position (vcVector): The coordinates of the point.

Returns:
int: The index of the new point in the set.
addPointIntegerReal x,
Real y,
Real z,
Real r,
Real g,
Real b,
Optional Keyword[a = Real]
Adds a point to the set with the given color. The point coordinates are in World coordinate system.
See more
Parameters:
x (float): X coordinate of the point.
y (float): Y coordinate of the point.
z (float): Z coordinate of the point.
r (float): Red component of the color.
g (float): Green component of the color.
b (float): Blue component of the color.
a (float): Alpha component of the color.

Returns:
int: The index of the new point in the set.
addPointIntegervcVector point,
vcColor color
Adds a point to the set with the given color. The point coordinates are in World coordinate system.
See more
Parameters:
position (vcVector): The coordinates of the point.
color (vcColor): The color.

Returns:
int: The index of the new point in the set.
clearPointsNoneNoneRemoves all points from the point set.
getPointColorvcColorInteger pointIndexGet the color of the point with the given an index.
See more
Parameters:
pointIndex (int): The index of the point.

Exceptions:
IndexError: When the index is out of range.

Returns:
vcColor: The point color.
getPointPositionvcVectorInteger pointIndexGet the position of the point with the given an index.
See more
Parameters:
pointIndex (int): The index of the point.

Exceptions:
IndexError: When the index is out of range.

Returns:
vcVector: The position of the point.
setPointColorNoneInteger pointIndex,
Real r,
Real g,
Real b,
Optional Keyword[a = Real]
Sets the RGB components of the color of the point at the given index.
Leaves the A (alpha) component unchanged.
See more
Parameters:
pointIndex (int): The index of the point.
r (float): Red component of the color.
g (float): Green component of the color.
b (float): Blue component of the color.

Exceptions:
IndexError: When the index is out of range.
setPointColorNoneInteger pointIndex,
vcColor color
Set the RGBA components of the color of the point at the given index.
See more
Parameters:
pointIndex (int): The index of the point.
color (vcColor): The color.

Exceptions:
IndexError: When the index is out of range.
setPointPositionNoneInteger pointIndex,
Real x,
Real y,
Real z
Set the point position at the given index.
See more
Parameters:
pointIndex (int): The index of the point.
x (float): X coordinate of the point.
y (float): Y coordinate of the point.
z (float): Z coordinate of the point.

Exceptions:
IndexError: When the index is out of range.
setPointPositionNoneInteger pointIndex,
vcVector position
Set the point position at the given index.
See more
Parameters:
pointIndex (int): The index of the point.
position (vcVector): The coordinates of the point.

Exceptions:
IndexError: When the index is out of range.
updateNoneNoneUpdates the bounding box of the point set.

Example: Render Point Cloud

"""Create point cloud with random data"""
import vcCore as vc
import vcFeatures as vc_fea
import vcGeometry as vc_geo
import random

app = vc.getApplication()
comp = vc.getComponent()

cloud_size = 1000.0
point_count = 100000

cloud_feat = comp.findFeature('PointCloud')
if not cloud_feat:
  cloud_feat = comp.RootFeature.create(vc_fea.vcFeatureType.GEOMETRY, 'PointCloud')
if cloud_feat.Geometry.GeometrySetCount == 0:
  cloud_set = cloud_feat.Geometry.createGeometrySet(vc_geo.vcGeometrySetType.POINT_SET)
else:
  cloud_set = cloud_feat.Geometry.getGeometrySet(0)
  cloud_set.clearPoints()

for i in range(point_count):
  x = cloud_size * random.random()
  y = cloud_size * random.random()
  z = cloud_size * random.random()
  r = random.random()
  g = random.random()
  b = random.random()
  cloud_set.addPoint(x, y, z, r, g, b)

cloud_set.update()
comp.rebuild()
app.render()